package com.genloong.flycloud.filecenter.api;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 微服务接口
 */
@FeignClient("notify-center")
public interface NotifyApi {
    /** 阿里云语音通知接口
     * @param object  {CalledNumber：”电话号码“，TtsCode，TemplateParam }
     * @return {}
     */
    @PostMapping("aliyunNotify/ttsNotify")
    JSONObject ttsNotify(@RequestBody JSONObject object);

    /**
     * @param object {"openid":"oujwQ1XQ5lQBPSS6t5w7ogS498HU"
     * ,"templateId":"AwtGXf48DAMuH5KJ7rvQBMsZMK-g-188AC0boT5VQbc"
     * ,"templateDatas":[{"name":"first",
     * "value":"测试通知","color":"#173177"}
     * ,{"name":"performance",
     * "value":"漏水通知","color":"#173177"}
     * ,{"name":"time",
     * "value":"2020年08月14日 12:54:22","color":"#173177"}
     * ,{"name":"remark",
     * "value":"请立即处理","color":"#173177"}],
     *               "miniProgram":{"appid":"","pagePath":"","usePath":false}
     *               ,"url":""}
     * @return  code==20000 成功
     */
    @PostMapping("wx/sendTemplateMessage")
    JSONObject sendTemplateMessage(@RequestBody JSONObject object);


    /**
     * @param redirectURI 微信授权
     * @param state
     * @return
     */
    @GetMapping("wx/oauth")
    JSONObject oauth(@RequestParam String redirectURI,@RequestParam String state);
    /**
     * @param code code  换取OpenID
     * @param state state  携带参数 可为空
     * @return
     */
    @GetMapping("wx/snsapiUserinfo")
    JSONObject snsapiUserinfo(@RequestParam String code,@RequestParam String state);
}
